<?php
/**
 * Created by PhpStorm.
 * User: 熵
 * Date: 2021/12/12
 * Time: 21:41
 */

require 'dbtool.php';
$key=$_COOKIE['userkey'];
session_start();
$userName = '';
$is_login = false;
$conn=new mysqli();
$conn->connect('127.0.0.1','root','root','bank');
if (!empty($conn->connect_error)){
    echo '数据库连接错误'.$conn->connect_error;
    die;
}
$sql='select RealName from accountinfo WHERE AccountId = (SELECT AccountId from bankcard WHERE CardNo ='.$_SESSION[$key]['username'].' )';
dbtool::setconn($conn);
$data=dbtool::selectconn($sql);
//print_r($data);
if(!isset($_SESSION[$key]['username'])){
    $userName= "你尚未登入，<a href='../login.php'>请登入</a>";
}else{
    $userName='欢迎您'.$data[0]['RealName'];
    $is_login = true;
    print_r($userName);
}